/*
 *
 * Copyright (c) 2013-2021, Alibaba Group Holding Limited;
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: TxnStream.proto

package com.aliyun.polardbx.binlog.protocol;

/**
 * Protobuf type {@code com.aliyun.polardbx.binlog.protocol.TxnItem}
 */
public final class TxnItem extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:com.aliyun.polardbx.binlog.protocol.TxnItem)
    TxnItemOrBuilder {
    private static final long serialVersionUID = 0L;

    // Use TxnItem.newBuilder() to construct.
    private TxnItem(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
        super(builder);
    }

    private TxnItem() {
        traceId_ = "";
        rowsQuery_ = "";
        payload_ = com.google.protobuf.ByteString.EMPTY;
    }

    @java.lang.Override
    @SuppressWarnings({"unused"})
    protected java.lang.Object newInstance(
        UnusedPrivateParameter unused) {
        return new TxnItem();
    }

    @java.lang.Override
    public final com.google.protobuf.UnknownFieldSet
    getUnknownFields() {
        return this.unknownFields;
    }

    private TxnItem(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
        this();
        if (extensionRegistry == null) {
            throw new java.lang.NullPointerException();
        }
        com.google.protobuf.UnknownFieldSet.Builder unknownFields =
            com.google.protobuf.UnknownFieldSet.newBuilder();
        try {
            boolean done = false;
            while (!done) {
                int tag = input.readTag();
                switch (tag) {
                case 0:
                    done = true;
                    break;
                case 10: {
                    java.lang.String s = input.readStringRequireUtf8();

                    traceId_ = s;
                    break;
                }
                case 18: {
                    java.lang.String s = input.readStringRequireUtf8();

                    rowsQuery_ = s;
                    break;
                }
                case 24: {

                    eventType_ = input.readInt32();
                    break;
                }
                case 34: {

                    payload_ = input.readBytes();
                    break;
                }
                default: {
                    if (!parseUnknownField(
                        input, unknownFields, extensionRegistry, tag)) {
                        done = true;
                    }
                    break;
                }
                }
            }
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
            throw e.setUnfinishedMessage(this);
        } catch (java.io.IOException e) {
            throw new com.google.protobuf.InvalidProtocolBufferException(
                e).setUnfinishedMessage(this);
        } finally {
            this.unknownFields = unknownFields.build();
            makeExtensionsImmutable();
        }
    }

    public static final com.google.protobuf.Descriptors.Descriptor
    getDescriptor() {
        return com.aliyun.polardbx.binlog.protocol.TxnStream.internal_static_com_aliyun_polardbx_binlog_protocol_TxnItem_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
    internalGetFieldAccessorTable() {
        return com.aliyun.polardbx.binlog.protocol.TxnStream.internal_static_com_aliyun_polardbx_binlog_protocol_TxnItem_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.aliyun.polardbx.binlog.protocol.TxnItem.class,
                com.aliyun.polardbx.binlog.protocol.TxnItem.Builder.class);
    }

    public static final int TRACEID_FIELD_NUMBER = 1;
    private volatile java.lang.Object traceId_;

    /**
     * <pre>
     * *
     * 1.traceId是分布式事务内，合并多个物理分片的事件时，进行排序的依据&lt;/br&gt;
     * 2.为了便于统一处理，不管是单机事务还是分布式事务都要求传入，并且要保证同一事务在同一物理分片的traceID单调递增 &lt;/br&gt;
     * 3.如果物理binlog中带有traceId标识，直接使用即可；如果物理binlog中不带有traceId标识，通过"时间戳+自增序列"手动生成 &lt;/br&gt;
     * </pre>
     *
     * <code>string traceId = 1;</code>
     *
     * @return The traceId.
     */
    @java.lang.Override
    public java.lang.String getTraceId() {
        java.lang.Object ref = traceId_;
        if (ref instanceof java.lang.String) {
            return (java.lang.String) ref;
        } else {
            com.google.protobuf.ByteString bs =
                (com.google.protobuf.ByteString) ref;
            java.lang.String s = bs.toStringUtf8();
            traceId_ = s;
            return s;
        }
    }

    /**
     * <pre>
     * *
     * 1.traceId是分布式事务内，合并多个物理分片的事件时，进行排序的依据&lt;/br&gt;
     * 2.为了便于统一处理，不管是单机事务还是分布式事务都要求传入，并且要保证同一事务在同一物理分片的traceID单调递增 &lt;/br&gt;
     * 3.如果物理binlog中带有traceId标识，直接使用即可；如果物理binlog中不带有traceId标识，通过"时间戳+自增序列"手动生成 &lt;/br&gt;
     * </pre>
     *
     * <code>string traceId = 1;</code>
     *
     * @return The bytes for traceId.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString
    getTraceIdBytes() {
        java.lang.Object ref = traceId_;
        if (ref instanceof java.lang.String) {
            com.google.protobuf.ByteString b =
                com.google.protobuf.ByteString.copyFromUtf8(
                    (java.lang.String) ref);
            traceId_ = b;
            return b;
        } else {
            return (com.google.protobuf.ByteString) ref;
        }
    }

    public static final int ROWSQUERY_FIELD_NUMBER = 2;
    private volatile java.lang.Object rowsQuery_;

    /**
     * <code>string rowsQuery = 2;</code>
     *
     * @return The rowsQuery.
     */
    @java.lang.Override
    public java.lang.String getRowsQuery() {
        java.lang.Object ref = rowsQuery_;
        if (ref instanceof java.lang.String) {
            return (java.lang.String) ref;
        } else {
            com.google.protobuf.ByteString bs =
                (com.google.protobuf.ByteString) ref;
            java.lang.String s = bs.toStringUtf8();
            rowsQuery_ = s;
            return s;
        }
    }

    /**
     * <code>string rowsQuery = 2;</code>
     *
     * @return The bytes for rowsQuery.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString
    getRowsQueryBytes() {
        java.lang.Object ref = rowsQuery_;
        if (ref instanceof java.lang.String) {
            com.google.protobuf.ByteString b =
                com.google.protobuf.ByteString.copyFromUtf8(
                    (java.lang.String) ref);
            rowsQuery_ = b;
            return b;
        } else {
            return (com.google.protobuf.ByteString) ref;
        }
    }

    public static final int EVENTTYPE_FIELD_NUMBER = 3;
    private int eventType_;

    /**
     * <pre>
     * *
     * 1.对应mysql的EventType
     * </pre>
     *
     * <code>int32 eventType = 3;</code>
     *
     * @return The eventType.
     */
    @java.lang.Override
    public int getEventType() {
        return eventType_;
    }

    public static final int PAYLOAD_FIELD_NUMBER = 4;
    private com.google.protobuf.ByteString payload_;

    /**
     * <pre>
     * *
     * 1.二进制数据
     * </pre>
     *
     * <code>bytes payload = 4;</code>
     *
     * @return The payload.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString getPayload() {
        return payload_;
    }

    private byte memoizedIsInitialized = -1;

    @java.lang.Override
    public final boolean isInitialized() {
        byte isInitialized = memoizedIsInitialized;
        if (isInitialized == 1) {
            return true;
        }
        if (isInitialized == 0) {
            return false;
        }

        memoizedIsInitialized = 1;
        return true;
    }

    @java.lang.Override
    public void writeTo(com.google.protobuf.CodedOutputStream output)
        throws java.io.IOException {
        if (!getTraceIdBytes().isEmpty()) {
            com.google.protobuf.GeneratedMessageV3.writeString(output, 1, traceId_);
        }
        if (!getRowsQueryBytes().isEmpty()) {
            com.google.protobuf.GeneratedMessageV3.writeString(output, 2, rowsQuery_);
        }
        if (eventType_ != 0) {
            output.writeInt32(3, eventType_);
        }
        if (!payload_.isEmpty()) {
            output.writeBytes(4, payload_);
        }
        unknownFields.writeTo(output);
    }

    @java.lang.Override
    public int getSerializedSize() {
        int size = memoizedSize;
        if (size != -1) {
            return size;
        }

        size = 0;
        if (!getTraceIdBytes().isEmpty()) {
            size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, traceId_);
        }
        if (!getRowsQueryBytes().isEmpty()) {
            size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, rowsQuery_);
        }
        if (eventType_ != 0) {
            size += com.google.protobuf.CodedOutputStream
                .computeInt32Size(3, eventType_);
        }
        if (!payload_.isEmpty()) {
            size += com.google.protobuf.CodedOutputStream
                .computeBytesSize(4, payload_);
        }
        size += unknownFields.getSerializedSize();
        memoizedSize = size;
        return size;
    }

    @java.lang.Override
    public boolean equals(final java.lang.Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof com.aliyun.polardbx.binlog.protocol.TxnItem)) {
            return super.equals(obj);
        }
        com.aliyun.polardbx.binlog.protocol.TxnItem other = (com.aliyun.polardbx.binlog.protocol.TxnItem) obj;

        if (!getTraceId()
            .equals(other.getTraceId())) {
            return false;
        }
        if (!getRowsQuery()
            .equals(other.getRowsQuery())) {
            return false;
        }
        if (getEventType()
            != other.getEventType()) {
            return false;
        }
        if (!getPayload()
            .equals(other.getPayload())) {
            return false;
        }
        if (!unknownFields.equals(other.unknownFields)) {
            return false;
        }
        return true;
    }

    @java.lang.Override
    public int hashCode() {
        if (memoizedHashCode != 0) {
            return memoizedHashCode;
        }
        int hash = 41;
        hash = (19 * hash) + getDescriptor().hashCode();
        hash = (37 * hash) + TRACEID_FIELD_NUMBER;
        hash = (53 * hash) + getTraceId().hashCode();
        hash = (37 * hash) + ROWSQUERY_FIELD_NUMBER;
        hash = (53 * hash) + getRowsQuery().hashCode();
        hash = (37 * hash) + EVENTTYPE_FIELD_NUMBER;
        hash = (53 * hash) + getEventType();
        hash = (37 * hash) + PAYLOAD_FIELD_NUMBER;
        hash = (53 * hash) + getPayload().hashCode();
        hash = (29 * hash) + unknownFields.hashCode();
        memoizedHashCode = hash;
        return hash;
    }

    public static com.aliyun.polardbx.binlog.protocol.TxnItem parseFrom(
        java.nio.ByteBuffer data)
        throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
    }

    public static com.aliyun.polardbx.binlog.protocol.TxnItem parseFrom(
        java.nio.ByteBuffer data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.aliyun.polardbx.binlog.protocol.TxnItem parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
    }

    public static com.aliyun.polardbx.binlog.protocol.TxnItem parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.aliyun.polardbx.binlog.protocol.TxnItem parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
    }

    public static com.aliyun.polardbx.binlog.protocol.TxnItem parseFrom(
        byte[] data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.aliyun.polardbx.binlog.protocol.TxnItem parseFrom(java.io.InputStream input)
        throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3
            .parseWithIOException(PARSER, input);
    }

    public static com.aliyun.polardbx.binlog.protocol.TxnItem parseFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3
            .parseWithIOException(PARSER, input, extensionRegistry);
    }

    public static com.aliyun.polardbx.binlog.protocol.TxnItem parseDelimitedFrom(java.io.InputStream input)
        throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3
            .parseDelimitedWithIOException(PARSER, input);
    }

    public static com.aliyun.polardbx.binlog.protocol.TxnItem parseDelimitedFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3
            .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
    }

    public static com.aliyun.polardbx.binlog.protocol.TxnItem parseFrom(
        com.google.protobuf.CodedInputStream input)
        throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3
            .parseWithIOException(PARSER, input);
    }

    public static com.aliyun.polardbx.binlog.protocol.TxnItem parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3
            .parseWithIOException(PARSER, input, extensionRegistry);
    }

    @java.lang.Override
    public Builder newBuilderForType() {
        return newBuilder();
    }

    public static Builder newBuilder() {
        return DEFAULT_INSTANCE.toBuilder();
    }

    public static Builder newBuilder(com.aliyun.polardbx.binlog.protocol.TxnItem prototype) {
        return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }

    @java.lang.Override
    public Builder toBuilder() {
        return this == DEFAULT_INSTANCE
            ? new Builder() : new Builder().mergeFrom(this);
    }

    @java.lang.Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
        Builder builder = new Builder(parent);
        return builder;
    }

    /**
     * Protobuf type {@code com.aliyun.polardbx.binlog.protocol.TxnItem}
     */
    public static final class Builder extends
        com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
        // @@protoc_insertion_point(builder_implements:com.aliyun.polardbx.binlog.protocol.TxnItem)
        com.aliyun.polardbx.binlog.protocol.TxnItemOrBuilder {
        public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
            return com.aliyun.polardbx.binlog.protocol.TxnStream.internal_static_com_aliyun_polardbx_binlog_protocol_TxnItem_descriptor;
        }

        @java.lang.Override
        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
            return com.aliyun.polardbx.binlog.protocol.TxnStream.internal_static_com_aliyun_polardbx_binlog_protocol_TxnItem_fieldAccessorTable
                .ensureFieldAccessorsInitialized(
                    com.aliyun.polardbx.binlog.protocol.TxnItem.class,
                    com.aliyun.polardbx.binlog.protocol.TxnItem.Builder.class);
        }

        // Construct using com.aliyun.polardbx.binlog.protocol.TxnItem.newBuilder()
        private Builder() {
            maybeForceBuilderInitialization();
        }

        private Builder(
            com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
            super(parent);
            maybeForceBuilderInitialization();
        }

        private void maybeForceBuilderInitialization() {
            if (com.google.protobuf.GeneratedMessageV3
                .alwaysUseFieldBuilders) {
            }
        }

        @java.lang.Override
        public Builder clear() {
            super.clear();
            traceId_ = "";

            rowsQuery_ = "";

            eventType_ = 0;

            payload_ = com.google.protobuf.ByteString.EMPTY;

            return this;
        }

        @java.lang.Override
        public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
            return com.aliyun.polardbx.binlog.protocol.TxnStream.internal_static_com_aliyun_polardbx_binlog_protocol_TxnItem_descriptor;
        }

        @java.lang.Override
        public com.aliyun.polardbx.binlog.protocol.TxnItem getDefaultInstanceForType() {
            return com.aliyun.polardbx.binlog.protocol.TxnItem.getDefaultInstance();
        }

        @java.lang.Override
        public com.aliyun.polardbx.binlog.protocol.TxnItem build() {
            com.aliyun.polardbx.binlog.protocol.TxnItem result = buildPartial();
            if (!result.isInitialized()) {
                throw newUninitializedMessageException(result);
            }
            return result;
        }

        @java.lang.Override
        public com.aliyun.polardbx.binlog.protocol.TxnItem buildPartial() {
            com.aliyun.polardbx.binlog.protocol.TxnItem result = new com.aliyun.polardbx.binlog.protocol.TxnItem(this);
            result.traceId_ = traceId_;
            result.rowsQuery_ = rowsQuery_;
            result.eventType_ = eventType_;
            result.payload_ = payload_;
            onBuilt();
            return result;
        }

        @java.lang.Override
        public Builder clone() {
            return super.clone();
        }

        @java.lang.Override
        public Builder setField(
            com.google.protobuf.Descriptors.FieldDescriptor field,
            java.lang.Object value) {
            return super.setField(field, value);
        }

        @java.lang.Override
        public Builder clearField(
            com.google.protobuf.Descriptors.FieldDescriptor field) {
            return super.clearField(field);
        }

        @java.lang.Override
        public Builder clearOneof(
            com.google.protobuf.Descriptors.OneofDescriptor oneof) {
            return super.clearOneof(oneof);
        }

        @java.lang.Override
        public Builder setRepeatedField(
            com.google.protobuf.Descriptors.FieldDescriptor field,
            int index, java.lang.Object value) {
            return super.setRepeatedField(field, index, value);
        }

        @java.lang.Override
        public Builder addRepeatedField(
            com.google.protobuf.Descriptors.FieldDescriptor field,
            java.lang.Object value) {
            return super.addRepeatedField(field, value);
        }

        @java.lang.Override
        public Builder mergeFrom(com.google.protobuf.Message other) {
            if (other instanceof com.aliyun.polardbx.binlog.protocol.TxnItem) {
                return mergeFrom((com.aliyun.polardbx.binlog.protocol.TxnItem) other);
            } else {
                super.mergeFrom(other);
                return this;
            }
        }

        public Builder mergeFrom(com.aliyun.polardbx.binlog.protocol.TxnItem other) {
            if (other == com.aliyun.polardbx.binlog.protocol.TxnItem.getDefaultInstance()) {
                return this;
            }
            if (!other.getTraceId().isEmpty()) {
                traceId_ = other.traceId_;
                onChanged();
            }
            if (!other.getRowsQuery().isEmpty()) {
                rowsQuery_ = other.rowsQuery_;
                onChanged();
            }
            if (other.getEventType() != 0) {
                setEventType(other.getEventType());
            }
            if (other.getPayload() != com.google.protobuf.ByteString.EMPTY) {
                setPayload(other.getPayload());
            }
            this.mergeUnknownFields(other.unknownFields);
            onChanged();
            return this;
        }

        @java.lang.Override
        public final boolean isInitialized() {
            return true;
        }

        @java.lang.Override
        public Builder mergeFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws java.io.IOException {
            com.aliyun.polardbx.binlog.protocol.TxnItem parsedMessage = null;
            try {
                parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
            } catch (com.google.protobuf.InvalidProtocolBufferException e) {
                parsedMessage = (com.aliyun.polardbx.binlog.protocol.TxnItem) e.getUnfinishedMessage();
                throw e.unwrapIOException();
            } finally {
                if (parsedMessage != null) {
                    mergeFrom(parsedMessage);
                }
            }
            return this;
        }

        private java.lang.Object traceId_ = "";

        /**
         * <pre>
         * *
         * 1.traceId是分布式事务内，合并多个物理分片的事件时，进行排序的依据&lt;/br&gt;
         * 2.为了便于统一处理，不管是单机事务还是分布式事务都要求传入，并且要保证同一事务在同一物理分片的traceID单调递增 &lt;/br&gt;
         * 3.如果物理binlog中带有traceId标识，直接使用即可；如果物理binlog中不带有traceId标识，通过"时间戳+自增序列"手动生成 &lt;/br&gt;
         * </pre>
         *
         * <code>string traceId = 1;</code>
         *
         * @return The traceId.
         */
        public java.lang.String getTraceId() {
            java.lang.Object ref = traceId_;
            if (!(ref instanceof java.lang.String)) {
                com.google.protobuf.ByteString bs =
                    (com.google.protobuf.ByteString) ref;
                java.lang.String s = bs.toStringUtf8();
                traceId_ = s;
                return s;
            } else {
                return (java.lang.String) ref;
            }
        }

        /**
         * <pre>
         * *
         * 1.traceId是分布式事务内，合并多个物理分片的事件时，进行排序的依据&lt;/br&gt;
         * 2.为了便于统一处理，不管是单机事务还是分布式事务都要求传入，并且要保证同一事务在同一物理分片的traceID单调递增 &lt;/br&gt;
         * 3.如果物理binlog中带有traceId标识，直接使用即可；如果物理binlog中不带有traceId标识，通过"时间戳+自增序列"手动生成 &lt;/br&gt;
         * </pre>
         *
         * <code>string traceId = 1;</code>
         *
         * @return The bytes for traceId.
         */
        public com.google.protobuf.ByteString
        getTraceIdBytes() {
            java.lang.Object ref = traceId_;
            if (ref instanceof String) {
                com.google.protobuf.ByteString b =
                    com.google.protobuf.ByteString.copyFromUtf8(
                        (java.lang.String) ref);
                traceId_ = b;
                return b;
            } else {
                return (com.google.protobuf.ByteString) ref;
            }
        }

        /**
         * <pre>
         * *
         * 1.traceId是分布式事务内，合并多个物理分片的事件时，进行排序的依据&lt;/br&gt;
         * 2.为了便于统一处理，不管是单机事务还是分布式事务都要求传入，并且要保证同一事务在同一物理分片的traceID单调递增 &lt;/br&gt;
         * 3.如果物理binlog中带有traceId标识，直接使用即可；如果物理binlog中不带有traceId标识，通过"时间戳+自增序列"手动生成 &lt;/br&gt;
         * </pre>
         *
         * <code>string traceId = 1;</code>
         *
         * @param value The traceId to set.
         * @return This builder for chaining.
         */
        public Builder setTraceId(
            java.lang.String value) {
            if (value == null) {
                throw new NullPointerException();
            }

            traceId_ = value;
            onChanged();
            return this;
        }

        /**
         * <pre>
         * *
         * 1.traceId是分布式事务内，合并多个物理分片的事件时，进行排序的依据&lt;/br&gt;
         * 2.为了便于统一处理，不管是单机事务还是分布式事务都要求传入，并且要保证同一事务在同一物理分片的traceID单调递增 &lt;/br&gt;
         * 3.如果物理binlog中带有traceId标识，直接使用即可；如果物理binlog中不带有traceId标识，通过"时间戳+自增序列"手动生成 &lt;/br&gt;
         * </pre>
         *
         * <code>string traceId = 1;</code>
         *
         * @return This builder for chaining.
         */
        public Builder clearTraceId() {

            traceId_ = getDefaultInstance().getTraceId();
            onChanged();
            return this;
        }

        /**
         * <pre>
         * *
         * 1.traceId是分布式事务内，合并多个物理分片的事件时，进行排序的依据&lt;/br&gt;
         * 2.为了便于统一处理，不管是单机事务还是分布式事务都要求传入，并且要保证同一事务在同一物理分片的traceID单调递增 &lt;/br&gt;
         * 3.如果物理binlog中带有traceId标识，直接使用即可；如果物理binlog中不带有traceId标识，通过"时间戳+自增序列"手动生成 &lt;/br&gt;
         * </pre>
         *
         * <code>string traceId = 1;</code>
         *
         * @param value The bytes for traceId to set.
         * @return This builder for chaining.
         */
        public Builder setTraceIdBytes(
            com.google.protobuf.ByteString value) {
            if (value == null) {
                throw new NullPointerException();
            }
            checkByteStringIsUtf8(value);

            traceId_ = value;
            onChanged();
            return this;
        }

        private java.lang.Object rowsQuery_ = "";

        /**
         * <code>string rowsQuery = 2;</code>
         *
         * @return The rowsQuery.
         */
        public java.lang.String getRowsQuery() {
            java.lang.Object ref = rowsQuery_;
            if (!(ref instanceof java.lang.String)) {
                com.google.protobuf.ByteString bs =
                    (com.google.protobuf.ByteString) ref;
                java.lang.String s = bs.toStringUtf8();
                rowsQuery_ = s;
                return s;
            } else {
                return (java.lang.String) ref;
            }
        }

        /**
         * <code>string rowsQuery = 2;</code>
         *
         * @return The bytes for rowsQuery.
         */
        public com.google.protobuf.ByteString
        getRowsQueryBytes() {
            java.lang.Object ref = rowsQuery_;
            if (ref instanceof String) {
                com.google.protobuf.ByteString b =
                    com.google.protobuf.ByteString.copyFromUtf8(
                        (java.lang.String) ref);
                rowsQuery_ = b;
                return b;
            } else {
                return (com.google.protobuf.ByteString) ref;
            }
        }

        /**
         * <code>string rowsQuery = 2;</code>
         *
         * @param value The rowsQuery to set.
         * @return This builder for chaining.
         */
        public Builder setRowsQuery(
            java.lang.String value) {
            if (value == null) {
                throw new NullPointerException();
            }

            rowsQuery_ = value;
            onChanged();
            return this;
        }

        /**
         * <code>string rowsQuery = 2;</code>
         *
         * @return This builder for chaining.
         */
        public Builder clearRowsQuery() {

            rowsQuery_ = getDefaultInstance().getRowsQuery();
            onChanged();
            return this;
        }

        /**
         * <code>string rowsQuery = 2;</code>
         *
         * @param value The bytes for rowsQuery to set.
         * @return This builder for chaining.
         */
        public Builder setRowsQueryBytes(
            com.google.protobuf.ByteString value) {
            if (value == null) {
                throw new NullPointerException();
            }
            checkByteStringIsUtf8(value);

            rowsQuery_ = value;
            onChanged();
            return this;
        }

        private int eventType_;

        /**
         * <pre>
         * *
         * 1.对应mysql的EventType
         * </pre>
         *
         * <code>int32 eventType = 3;</code>
         *
         * @return The eventType.
         */
        @java.lang.Override
        public int getEventType() {
            return eventType_;
        }

        /**
         * <pre>
         * *
         * 1.对应mysql的EventType
         * </pre>
         *
         * <code>int32 eventType = 3;</code>
         *
         * @param value The eventType to set.
         * @return This builder for chaining.
         */
        public Builder setEventType(int value) {

            eventType_ = value;
            onChanged();
            return this;
        }

        /**
         * <pre>
         * *
         * 1.对应mysql的EventType
         * </pre>
         *
         * <code>int32 eventType = 3;</code>
         *
         * @return This builder for chaining.
         */
        public Builder clearEventType() {

            eventType_ = 0;
            onChanged();
            return this;
        }

        private com.google.protobuf.ByteString payload_ = com.google.protobuf.ByteString.EMPTY;

        /**
         * <pre>
         * *
         * 1.二进制数据
         * </pre>
         *
         * <code>bytes payload = 4;</code>
         *
         * @return The payload.
         */
        @java.lang.Override
        public com.google.protobuf.ByteString getPayload() {
            return payload_;
        }

        /**
         * <pre>
         * *
         * 1.二进制数据
         * </pre>
         *
         * <code>bytes payload = 4;</code>
         *
         * @param value The payload to set.
         * @return This builder for chaining.
         */
        public Builder setPayload(com.google.protobuf.ByteString value) {
            if (value == null) {
                throw new NullPointerException();
            }

            payload_ = value;
            onChanged();
            return this;
        }

        /**
         * <pre>
         * *
         * 1.二进制数据
         * </pre>
         *
         * <code>bytes payload = 4;</code>
         *
         * @return This builder for chaining.
         */
        public Builder clearPayload() {

            payload_ = getDefaultInstance().getPayload();
            onChanged();
            return this;
        }

        @java.lang.Override
        public final Builder setUnknownFields(
            final com.google.protobuf.UnknownFieldSet unknownFields) {
            return super.setUnknownFields(unknownFields);
        }

        @java.lang.Override
        public final Builder mergeUnknownFields(
            final com.google.protobuf.UnknownFieldSet unknownFields) {
            return super.mergeUnknownFields(unknownFields);
        }

        // @@protoc_insertion_point(builder_scope:com.aliyun.polardbx.binlog.protocol.TxnItem)
    }

    // @@protoc_insertion_point(class_scope:com.aliyun.polardbx.binlog.protocol.TxnItem)
    private static final com.aliyun.polardbx.binlog.protocol.TxnItem DEFAULT_INSTANCE;

    static {
        DEFAULT_INSTANCE = new com.aliyun.polardbx.binlog.protocol.TxnItem();
    }

    public static com.aliyun.polardbx.binlog.protocol.TxnItem getDefaultInstance() {
        return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<TxnItem>
        PARSER = new com.google.protobuf.AbstractParser<TxnItem>() {
        @java.lang.Override
        public TxnItem parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
            return new TxnItem(input, extensionRegistry);
        }
    };

    public static com.google.protobuf.Parser<TxnItem> parser() {
        return PARSER;
    }

    @java.lang.Override
    public com.google.protobuf.Parser<TxnItem> getParserForType() {
        return PARSER;
    }

    @java.lang.Override
    public com.aliyun.polardbx.binlog.protocol.TxnItem getDefaultInstanceForType() {
        return DEFAULT_INSTANCE;
    }

}

